package cn.npe2.scaffolding.controller;

import cn.npe2.scaffolding.model.TestModel;
import cn.npe2.scaffolding.service.TestService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Echan
 * @since 2022-04-01 18:32
 */

@RestController
@RequestMapping("/test")
public class TestController {

    private final TestService testService;

    public TestController(TestService testService) {
        this.testService = testService;
    }

    @GetMapping
    public List<TestModel> getAll() {
        return testService.list(Wrappers.lambdaQuery(TestModel.class)
                .eq(TestModel::getId, 1));
    }

}
